//
//  SinaWeibo.h
//  YuiKe
//
//  Created by yuike5 yuike5 on 11-10-24.
//  Copyright 2011年 yuike. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "WeiboHeader.h"
#import "WeiboClient.h"
#import "Draft.h"
#import "WBEngine.h"

@class WBEngine;

@interface SinaWeibo : WeiboBase<UIWebViewDelegate, WeiboShortUrlShortenDelegate, WBEngineDelegate, WeiboShortUrlShortenArrayDelegate>
{
    WBEngine *_engine;
    NSMutableArray* _array;
    
    int _apiType; // 默认为0
    SinaWeibo* step_ShortUrl;
    long long bak_max_id;
    int bak_count; 
    BOOL bak_force;
    
    BOOL short_url_shorten_autorelease; // default false
    
    int max_callback_shorten_url_share_statuses_count;
}
@property (nonatomic, assign) BOOL short_url_shorten_autorelease;
@property (nonatomic, assign) int max_callback_shorten_url_share_statuses_count;


+(void) setDefaultKey:(NSString*)key andSecret:(NSString*)secret;
+(void) setSinaWeiboAtNick:(NSString*)nick;



//-(void) getNode:(id<WeiboNodeShowDelegate>)delegate_ urlid:(NSString*)urlid;
//-(void) getCommentsSINAv1:(id<WeiboCommentsShowDelegate>)delegate_ 
//                    urlid:(NSString*)urlid
//                    count:(int)count
//                     page:(int)page;


-(void) short_url_shorten:(NSString*)long_url  delegate:(id<WeiboShortUrlShortenDelegate>)delegate;// 长链转短链 
-(void) short_url_shortenArrayMax20:(NSMutableArray*)long_url_array delegate:(id<WeiboShortUrlShortenArrayDelegate>)delegate;
-(void) short_url_clicks:(NSString*)short_url delegate:(id<WeiboShortUrlClicksDelegate>)delegate forceConnect:(BOOL)force;// 获取短链接的总点击数 
-(void) short_url_clicksArrayMax20:(NSMutableArray*)short_url_array delegate:(id<WeiboShortUrlClicksArrayDelegate>)delegate forceConnect:(BOOL)force;

-(void) short_url_share_counts:(NSString*)short_url delegate:(id<WeiboShortUrlShareCountsDelegate>)delegate;// 获取短链接在微博上的微博分享数 
-(void) short_url_share_statuses:(NSString*)short_url max_id:(long long)max_id count:(int)count delegate:(id<WeiboShortUrlShareStatusDelegate>)delegate;// 获取包含指定单个短链接的最新微博内容 
-(void) short_url_comment_counts:(NSString*)short_url delegate:(id<WeiboShortUrlCommentCountsDelegate>)delegate;// 获取短链接在微博上的微博评论数 
-(void) short_url_comment_comments:(NSString*)short_url max_id:(long long)max_id count:(int)count delegate:(id<WeiboShortUrlCommentCommentsDelegate>)delegate;// 获取包含指定单个短链接的最新微博评论 


-(void) short_url_clicks_bylong:(NSString*)long_url delegate:(id<WeiboShortUrlClicksDelegate>)delegate forceConnect:(BOOL)force;// 获取短链接的总点击数 
-(void) short_url_clicks_bylongArrayMax20:(NSMutableArray*)long_url_array delegate:(id<WeiboShortUrlClicksArrayDelegate>)delegate forceConnect:(BOOL)force;

-(void) short_url_share_counts_bylong:(NSString*)long_url delegate:(id<WeiboShortUrlShareCountsDelegate>)delegate;// 获取短链接在微博上的微博分享数 
-(void) short_url_share_statuses_bylong:(NSString*)long_url max_id:(long long)max_id count:(int)count delegate:(id<WeiboShortUrlShareStatusDelegate>)delegate;// 获取包含指定单个短链接的最新微博内容 
-(void) short_url_comment_counts_bylong:(NSString*)long_url delegate:(id<WeiboShortUrlCommentCountsDelegate>)delegate;// 获取短链接在微博上的微博评论数 
-(void) short_url_comment_comments_bylong:(NSString*)long_url max_id:(long long)max_id count:(int)count delegate:(id<WeiboShortUrlCommentCommentsDelegate>)delegate;// 获取包含指定单个短链接的最新微博评论 

+(void) clearClicksCache;
+(void) short_url_click:(NSString*)short_url;
+(void) short_url_click_bylong:(NSString*)long_url;

//* 新浪微博mid与url互转实用工具
// 62进制字典
//#define str62keys @"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
/**
 * 62进制值转换为10进制
 * @param {String} str62 62进制值
 * @return {String} 10进制值
 */
+(NSString*) str62to10:(NSString*)str62;
/**
 * 10进制值转换为62进制
 * @param {String} int10 10进制值
 * @return {String} 62进制值
 */
+(NSString*) int10to62:(NSString*)int10;
/**
 * URL字符转换为mid
 * @param {String} url 微博URL字符，如 "wr4mOFqpbO"
 * @return {String} 微博mid，如 "201110410216293360"
 */
+(NSString*) url2mid:(NSString*)url;
/**
 * mid转换为URL字符
 * @param {String} mid 微博mid，如 "201110410216293360"
 * @return {String} 微博URL字符，如 "wr4mOFqpbO"
 */
+(NSString*) mid2url:(NSString*)mid;
@end
